#!/usr/bin/env python
# encoding: utf-8
"""
testGenerator.py

Created by Dmitry Tsybin on 2011-03-23.
Copyright (c) 2011 __MyCompanyName__. All rights reserved.
"""

import sys
import os
import unittest
import random

class TestGenerator:
	'''Класс генерирует тестовые данные'''
	
	def __init__(self):
		self.okList = [ ]
		self.discordList = [ ]
		self.crashList = [ ]
		
	def generateList(self, length = 100, mean = 0.05, variance = 0.05):
		coef = 1000
		i = 0
		while i < length:
			if i < length * 0.8:
				self.okList.append(random.randint(0, (mean + variance) * coef) / coef)
			elif i < length * 0.9:
				self.discordList.append(random.randint((mean + variance) * coef,  (mean + variance + 2 * variance) * coef) / coef)	
			else:
				self.crashList.append(random.randint((mean + variance) * 5 * coef, coef) / coef)
			i += 1
		return self.okList + self.discordList + self.crashList
		

class TestGeneratorTests(unittest.TestCase):
	
	def testGenerateList(self):
		testUnit = TestGenerator()
		length = 100
		result = testUnit.generateList(length)
		self.assertEqual(len(result), length)


if __name__ == '__main__':
	unittest.main()